Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: OpenDoc Class Reference /
Part 1 - Classes and Methods / ODObject


Purge

The Purge method releases any unneeded memory during low-memory situations.

ODSize Purge (in ODSize size);
size
The number of bytes needed by OpenDoc, expressed as an unsigned 32-bit value.
return value
The number of bytes that were released by this object.
DISCUSSION
Your part may call this method, but in general, OpenDoc calls this method in low-memory situations to free any caches, noncritical buffers, or objects; you should not allocate memory for this operation.

Because the ODObject class does not allocate (or deallocate) any memory, it always returns the value 0.

OVERRIDING
Every subclass of ODObject can override this method and should do so if it creates caches and temporary buffers. Your subclass of ODPart must override this method or risk running out of available memory. Your override method must call its inherited Purge method at some point in your implementation (it does not matter where). You should save the size value returned by the inherited Purge method, and then add it to the size value returned by your override method to determine the amount of memory actually released.

SEE ALSO
The ODPart class (page 459).
"The Purge Method" on page 115 in OpenDoc Cookbook.
Table 2-1 on page 89 in OpenDoc Programmer's Guide.
"Reference-Counted Objects" on page 468 in OpenDoc Programmer's Guide.
"Purging" on page 472 in OpenDoc Programmer's Guide.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
17 JUL 1996




Navigation graphic, see text links

Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help